//
//  FGHomeViewController.swift
//  微博
//
//  Created by 陈金田 on 16/12/29.
//  Copyright © 2016年 陈金田. All rights reserved.
//

import UIKit


private let cellId = "cellId"


class FGHomeViewController: FGBaseViewController {

     lazy var statusList = [String]()
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        loadData()
    }
    //重写基类加载数据方法
    override func loadData() {
        for  i in 0..<15{
            statusList.insert(i.description, at: 0)
        }
        
    }
    
    
    
    
    
    //显示好友
    func showFriends(){
        
        print(#function)
      let vc = FGDemoViewController()
      //当推出的时候隐藏底下bar
      vc.hidesBottomBarWhenPushed = true
      navigationController?.pushViewController(vc, animated: true)
        
    }

    
}



//表格数据源方法
extension FGHomeViewController{
   
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return statusList.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath)
        
        cell.textLabel?.text = statusList[indexPath.row]
        
        return cell
        
    }
    
}

//设置界面
extension FGHomeViewController{
    //重写父类方法
    override func setupdUI() {
        super.setupdUI()
        //设置导航栏按钮
        let btn : UIButton = UIButton.cz_textButton("好友", fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)

        btn.addTarget(self, action: #selector(showFriends), for: .touchUpInside)
        navItem.leftBarButtonItem = UIBarButtonItem(customView: btn)
        tableView?.register(UITableViewCell.self, forCellReuseIdentifier: cellId)
    //如果隐藏了导师航栏，会缩进20个点
       automaticallyAdjustsScrollViewInsets = false
        
    }
    
    
    
    
}











